package cn.com.truelore.common;

import cn.com.truelore.R;

import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;

public class CommonAlertDialog {

	private static boolean _flg = false;

	public static void ShowAlertInfo(Context context, String messageInfo) {
		AlertDialog.Builder ad = new AlertDialog.Builder(context);
		ad.setTitle(context.getResources().getString(R.string.app_name));
		ad.setMessage(messageInfo);
		ad.setPositiveButton("OK", null);
		ad.show();
	}

	public static void ShowAlertInfo(Context context, String title,
			String messageInfo) {
		new AlertDialog.Builder(context).setTitle(title)
				.setMessage(messageInfo).setPositiveButton("OK", null).show();
	}

	// by yangke 2012-03-13 begin
	public static boolean ShowAgreeOrUnAgree(Context context, String title,
			String messageInfo) {
		AlertDialog.Builder ad = new AlertDialog.Builder(context);
		ad.setTitle(title);
		ad.setMessage(messageInfo);
		ad.setPositiveButton("Agree", new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int i) {
				_flg = true;
			}
		});
		ad.setNegativeButton("Disagree", new DialogInterface.OnClickListener() {
			public void onClick(DialogInterface dialog, int i) {
				_flg = false;
			}
		});
		AlertDialog aaa = ad.create();
		ad.show();

		return _flg;
	}
	// by yangke 2012-03-13 end
}
